import { request } from "@/utils/request";
import Qs from "qs";

// 产品部审核列表
export function getStockPcList(data) {
    return request({
        url: "/basic/stock/getStockPcList",
        method: "post",
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        data: Qs.stringify(data),
    });
}

// 招商部产品审核列表
export function getRecruiterList(data) {
    return request({
        url: "/basic/stock/getRecruiterList",
        method: "post",
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        data: Qs.stringify(data),
    });
}

// 产品部审核驳回
export function refuse(data) {
    return request({
        url: "/basic/stock/refuse",
        method: "post",
        data
    });
}

// 产品部审核通过
export function pass(data) {
    return request({
        url: "/basic/stock/pass",
        method: "post",
        data
    });
}

// 招商部产品审核列表
export function againStock(data) {
    return request({
        url: "/basic/stock/againStock",
        method: "post",
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        data: Qs.stringify(data),
    });
}

// 产品部入库记录
export function getStorageRecord(data) {
    return request({
        url: "/basic/stock/getStorageRecord",
        method: "post",
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        data: Qs.stringify(data),
    });
}

// 产品部入库记录详情
export function getStorageId(data) {
    return request({
        url: "/basic/stock/getStorageId",
        method: "post",
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        data: Qs.stringify(data),
    });
}

// 产品部入库记录详情修改留存照片
export function updateByStorageId(data) {
    return request({
        url: "/basic/stock/updateByStorageId",
        method: "post",
        data
    });
}

// 产品部出库记录详情修改留存照片
export function updateOutStockAppList(data) {
    return request({
        url: "/basic/stockProduct/updateOutStockAppList",
        method: "post",
        data
    });
}


/**
 * 获取部门列表（根据登陆人筛选）
 * @param 
 */
export const loginDeptList = () => {
    return request({
        url: '/system/dept/loginDeptList',
        method: 'get'
    });
};

/**
 * 获取部门下的所有用户信息
 */
export const getUserList = (data: any) => {
    return request({
        url: '/basic/util/getUserList',
        method: 'get',
        params: data
    });
};

/**
 * 查询电商部门
 */
export const geCorePage = (data: any) => {
    return request({
        url: '/stock/passer/getDeptPage',
        method: 'post',
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        data: Qs.stringify(data),
    });
};

/**
 * 获取部门列表根据部门名称查下级 带分页
 * @param 
 */
export const getOutDepByName = (data: { deptName: string }) => {
    return request({
        url: '/basic/outDept/getOutDepByNamePage',
        method: 'post',
        data
    });
};

/**
 * 查询出库商品列表
 */
export const queryProduct = (data: any) => {
    return request({
        url: '/basic/warehouse/queryProduct',
        method: 'post',
        data
    });
};

/**
 * 产品库上架下架
 */
export const setUpDownShelves = (data: any) => {
    return request({
        url: '/basic/stock/grounding',
        method: 'post',
        data
    });
};

/**
 * 补样入库
 */
export const supplementInStock = (data: any) => {
    return request({
        url: '/basic/stockIn/supplementInStock',
        method: 'post',
        data
    });
};

/**
 * 还品入库
 */
export const coreReturnInStock = (data: any) => {
    return request({
        url: '/basic/stockIn/coreReturnInStock',
        method: 'post',
        data
    });
};


/**
 * 主播选品出库
 */
export const addStockOut = (data: any) => {
    return request({
        url: '/basic/stockProduct/addStockOut',
        method: 'post',
        data
    });
};

/**
 * 还品出库单 关联单查询
 */
export const stockOutQueryProduct = (data: any) => {
    return request({
        url: '/basic/stockOut/stockOutQueryProduct',
        method: 'post',
        data
    });
};

/**
 * 还品出库单商品扫描（主播还品入库扫面的商品接口）
 */
export const scanGetOutProduct = (data: any) => {
    return request({
        url: '/basic/stockOut/scanGetOutProduct',
        method: 'post',
        data
    });
};

/**
 * 验证货架码
 */
export const stockLocation = (data: any) => {
    return request({
        url: '/stock/stockLocation/get',
        method: 'post',
        data
    });
};
/**
 * 验证货架码上是否存在商品
 */
export const checkLocationExistStock = (data: any) => {
    return request({
        url: '/stock/stock/checkLocationExistStock',
        method: 'post',
        data
    });
};

/**
 * 下架记录
 */
export const getOffRecordList = (data: any) => {
    return request({
        url: "/basic/stock/getOffRecordList",
        method: "post",
        data,
    });
};

/**
 * 下架记录详情
 */
export const getOffRecordId = (id: string) => {
    return request({
        url: "/basic/stock/" + id,
        method: "post",
    });
};


/**
 * 获取产品部门信息
 * @param query
 * @returns {*}
 */

export const getStickProductDept = () => {
    return request({
        url: "/stock/passer/getStickDept",
        method: "post",
    });
};

/**
 * 获取产品部门信息
 * @param query
 * @returns {*}
 */

export const getUserProductList = (data: any) => {
    return request({
        url: "/stock/passer/getUserList",
        method: "post",
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        data: Qs.stringify(data),
    });
};

/**
 * 获取版本信息
 * @param 
 */
export const getVersion = () => {
    return request({
        url: '/basic/hmDescribe/list',
        method: 'get'
    });
};

/**
 * 查询货架下所有的商品
 * @param data
 * @returns {*}
 */

export const scanGoodsShelves = (data) => {
    return request({
        url: "/basic/stock/scanGoodsShelves",
        method: "post",
        data
    });
};


/**
 * 更换货架扫描商品
 * @param data
 * @returns {*}
 */

export const selectGrounding = (data) => {
    return request({
        url: "/basic/stock/selectGrounding",
        method: "post",
        data
    });
};

/**
 * 确认调拨
 * @param data
 * @returns {*}
 */

export const addAllocate = (data) => {
    return request({
        url: "/basic/stock/addAllocate",
        method: "post",
        data
    });
};

/**
 * 生成盘点单,返回盘点单ID
 * @param data
 * @returns {*}
 */

export const generateCountCode = () => {
    return request({
        url: "/basic/stockCount/generateCountCode",
        method: "post",
    });
};

/**
 * 盘点单选择商品,生成明细
 */
export const queryProductById = (data: any) => {
    return request({
        url: "/basic/stockCount/queryProductById",
        method: "post",
        data
    });
};

/**
 * 根据库位查询商品
 * @param data
 * @returns {*}
 */

export const queryProductByLocation = (data: any) => {
    return request({
        url: "/basic/stockCount/queryProductByLocation",
        method: "post",
        data
    });
};

/**
 * 获取当前盘点明细及库存
 * @param data
 * @returns {*}
 */

export const getCurrentStockDetail = (data: any) => {
    return request({
        url: "/basic/stockCount/getCurrentStockDetail",
        method: "post",
        data
    });
};


/**
 * 修正库存
 * @param data
 * @returns {*}
 */

export const doCount = (data: any) => {
    return request({
        url: "/basic/stockCount/doCount",
        method: "post",
        data
    });
};


/**
 * 盘点完成
 * @param data
 * @returns {*}
 */

export const doCountFinish = (data: any) => {
    return request({
        url: "/basic/stockCount/doCountFinish",
        method: "post",
        data
    });
};

/**
 * 查询盘点是否包含下架商品
 * @param data
 * @returns {*}
 */

export const checkShelfStatus = (data: any) => {
    return request({
        url: "/basic/stockCount/checkShelfStatus",
        method: "post",
        data
    });
};

/**
 * 盘点记录列表
 * @param data
 * @returns {*}
 */

export const queryCountList = (data: any) => {
    return request({
        url: "/basic/stockCount/queryCountList",
        method: "post",
        data
    });
};

/**
 * 盘点记录详情
 * @param data
 * @returns {*}
 */

export const queryCountDetailList = (data: any) => {
    return request({
        url: "/basic/stockCount/queryCountDetailList",
        method: "post",
        data
    });
};

/**
 * 根据商品查询盘点记录(30天)
 * @param data
 * @returns {*}
 */

export const queryCountDetailByProduct = (data: any) => {
    return request({
        url: "/basic/stockCount/queryCountDetailByProduct",
        method: "post",
        data
    });
};

/**
 * 调拨记录
 * @param data
 * @returns {*}
 */

export const selectAllotList = (data: any) => {
    return request({
        url: "/basic/stock/selectAllotList",
        method: "post",
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        data: Qs.stringify(data),
    });
};

/**
 * 根据商品查询调拨记录(30天)
 * @param data
 * @returns {*}
 */

export const selectAllotListByTime = (data: any) => {
    return request({
        url: "/basic/stock/selectAllotListByTime",
        method: "post",
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        data: Qs.stringify(data),
    });
};


/**
 * 流水页面的数量统计
 * @param data
 * @returns {*}
 */

export const getFlowingCount = () => {
    return request({
        url: "	/basic/stock/getFlowingCount",
        method: "post",
    });
};

/**
 * 根据商品查询入库记录(30天)
 * @param data
 * @returns {*}
 */

export const getStorageRecordByTime = (data: any) => {
    return request({
        url: "/basic/stock/getStorageRecordByTime",
        method: "post",
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        data: Qs.stringify(data),
    });
};
/**
 * 根据商品查询出库记录(30天)
 * @param data
 * @returns {*}
 */

export const selectOutStockAppListByTime = (data: any) => {
    return request({
        url: "/basic/stockOut/selectOutStockAppListByTime",
        method: "post",
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        data: Qs.stringify(data),
    });
};

/**
 * 查询近30内超期数量
 * @param data
 * @returns {*}
 */

export const selectOutListByTimeCount = (data: any) => {
    return request({
        url: "/basic/stockProduct/selectOutListByTimeCount/" + data,
        method: "post",
    });
};


/**
 * 出库记录
 * @param query
 * @returns {*}
 */

export const selectOutStockList = (data: any) => {
    return request({
        url: "/basic/stockProduct/selectOutStockAppList",
        method: "post",
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        data: Qs.stringify(data),
    });
};

/**
 * 已作废记录
 * @param query
 * @returns {*}
 */

export const selectCancelOutAppList = (data: any) => {
    return request({
        url: "/basic/stockProduct/selectCancelOutAppList",
        method: "post",
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        data: Qs.stringify(data),
    });
};

/**
 * 出库记录详情
 * @param query
 * @returns {*}
 */

export const selectOutStockById = (data: any) => {
    return request({
        url: "/basic/stockProduct/selectOutStockById",
        method: "post",
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        data: Qs.stringify(data),
    });
};

// 楼层库位树
export function locationTree(data: any) {
    return request({
        url: '/stock/stockLocation/locationTree',
        method: 'post',
        data
    });
}

// 首页 根据时间统计
export function timeTotal(data: any) {
    return request({
        url: '/basic/stock/timeTotal',
        method: 'post',
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        data: Qs.stringify(data),
    });
}

// 首页 根据时间统计
export function getTotal() {
    return request({
        url: '/basic/stock/total',
        method: 'post',
    });
}

// 首页 招商入库   还品入库   补样入库
export function getTotalList(data: any) {
    return request({
        url: '/basic/stock/getTotalList',
        method: 'post',
        data,
    });
}

// 首页 还品出库
export function getOutTotalList(data: any) {
    return request({
        url: '/basic/stock/getOutTotalList',
        method: 'post',
        data,
    });
}

// 统计单向总库存
export function statisticsStock(data: any) {
    return request({
        url: '/stock/stockRecord/statisticsStock',
        method: 'post',
        data
    });
}

// 查询库存流水
export function stockRecordList(data: any) {
    return request({
        url: '/stock/stockRecord/list',
        method: 'post',
        data
    });
}

// 产品变价列表
export function getStockAppList(data: any) {
    return request({
        url: '/basic/changeAudit/getStockAppList',
        method: 'post',
        data
    });
}

// 产品部变价接收操作
export const stockAccept = (data: any) => {
    return request({
        url: '/basic/changeAudit/stockAccept',
        method: 'post',
        data
    });
};

// 商品易主-查询所有部门
export const queryList = (data: any) => {
    return request({
        url: '/system/dept/queryList',
        method: 'get',
        params: data
    });
};

// 出库详单作废
export const cancelStockOut = (data: any) => {
    return request({
        url: '/basic/stockProduct/cancelStockOut',
        method: 'post',
        data
    });
};

// 补样数据列表
export const getSampleInvitationList = (data: any) => {
    return request({
        url: '/basic/sampleInvitation/getSampleInvitationList',
        method: 'post',
        data
    });
};
// 补样数据列表统计数字
export const getDataStatistics = (data: any) => {
    return request({
        url: '/basic/sampleInvitation/getDataStatistics',
        method: 'post',
        data
    });
};
// 补样数据列表详情
export const getById = (data: any) => {
    return request({
        url: '/basic/sampleInvitation/getById',
        method: 'post',
        data
    });
};
// 补样数据拒绝响应
export const refuseResPond = (data: any) => {
    return request({
        url: '/basic/sampleInvitation/refuseResPond',
        method: 'post',
        data
    });
};
// 补样数据跳过物流单号
export const skipExpress = (data: any) => {
    return request({
        url: '/basic/sampleInvitation/skipExpress',
        method: 'post',
        data
    });
};

// 补样数据确认物流单号
export const addExpress = (data: any) => {
    return request({
        url: '/basic/sampleInvitation/addExpress',
        method: 'post',
        data
    });
};

// 补样数据入库
export const batchStorage = (data: any) => {
    return request({
        url: '/basic/sampleInvitation/batchStorage',
        method: 'post',
        data
    });
};






